package com.itheima.springboot_init;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//这个是为了让spring扫描到
@RestController
public class springBoot_test {

    @Value("${name}")
    private String name;

    @Value("${person.name}")
    private String username;

    @Value("${people[0]}")
    private String ID;

    @Value("${mes1}")
    private String mes1;

    @Autowired
    private Environment evn;

    @Autowired
    private Person person;


    //增加一个映射
    @RequestMapping("/hello")
    public String hello(){
        System.out.println("草泥马");
        return "草泥马";
    }

    @RequestMapping("/run")
    public void run() {
        System.out.println(name);
        System.out.println(username);
        System.out.println(ID);
        System.out.println(mes1);
        System.out.println(evn.getProperty("person.name"));
        System.out.println(person);
    }



}
